package com.hk;

public class Umpire {
	private int[] pBall;
	private int[] hBall;
	private int arrlength;

	public Umpire() {
		this(3);
	}
	public Umpire(int n) {
		this.arrlength = n;
		pBall = new int[n];
		hBall = new int[n];
	}
	public Umpire(int[] pBall, int[] hBall) {
		this.pBall = pBall;
		this.hBall = hBall;
	}
	public void setpBall(int[] pBall) {
		this.pBall = pBall;
	}
	public void sethBall(int[] hBall) {
		this.hBall = hBall;
	}
	public int strike(){
		int cnt = 0;
		for (int i = 0; i < arrlength ; i++) {
			if (hBall[i]==pBall[i]) {		cnt++;			}
		}
		return cnt;
	}
	public int ball() {
		int cnt = 0;
		for (int i = 0; i < arrlength ; i++) {
			for (int j = 0; j < arrlength; j++) {
				if (i!=j && hBall[i]==pBall[j]) {		cnt++;			}
			}
		}
		return cnt;
	}
}
